package eerbaar.v2.pattern.client.internal;

import eerbaar.message.lib.NotifyPetMove;
import eerbaar.shared.message.MsgHelper;
import eerbaar.shared.service.ServiceFactory;
import eerbaar.v2.app.mover.IPersonaMover;
import eerbaar.v2.app.strategy.FreePlayStrategy;

public class FreePlayCommand {

    public FreePlayCommand() {
        //
    }

    public void execute() {

        IPersonaMover mover = ServiceFactory.getService(IPersonaMover.class);
        if (mover != null) {
            MsgHelper.sendMsg(NotifyPetMove.class, new NotifyPetMove());
            mover.freePlay();
        }
    }

    public boolean isRunning() {

        IPersonaMover mover = ServiceFactory.getService(IPersonaMover.class);
        if (mover.getStrategy().getClass() == FreePlayStrategy.class) {
            return true;
        }
        return false;
    }

}
